package com.lovo.pz.role;

import com.lovo.pz.util.GameUtil;

import java.awt.*;

/**
 * 太阳种子角色
 * @author 白德柯
 *
 */
public class SunSeedRole extends BaseRole{
    public SunSeedRole(Component component){
        super(component);
    }
    @Override
    public void initRole() {
        setMoveLength(2);
        setRoleWidth(GameUtil.sunSeedImage.getWidth(getComponent()));
        setRoleHeight(GameUtil.sunSeedImage.getHeight(getComponent()));
    }

    @Override
    public void paintRole(Graphics g) {
        g.drawImage(GameUtil.sunSeedImage,getRoleX(),getRoleY(),getComponent());
    }

    @Override
    public void action() {
        if(getRoleY() > 500){
            // 开始计时
            if(GameUtil.delay(2000,this,"sunend")){
                setRunStatus(ROLE_END);
            }
        }else{
            setRoleY(getRoleY() + getMoveLength());
        }
    }
}
